<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    @include('public.h5_head')
    <title>查询结果</title>
    <script src="{{ env('CDN_DOMAIN_NAME') }}/js/commonjs/rem.js"></script>
    <link rel="stylesheet" type="text/css" href="{{ env('CDN_DOMAIN_NAME') }}/css/commoncss/common.css"/>
    <link rel="stylesheet" type="text/css" href="{{ env('CDN_DOMAIN_NAME') }}/css/result.css"/>
    <style>
        .pay_mask{width:100%;height:100%;position:absolute;top:0;left:0;z-index:1000;background:#000;}
        .pay_mask2{opacity:0.4;filter:alpha(opacity=40)}

        .pay_over{width:11.52rem;min-height:4.48rem;text-align:center;color:#383838;background:#F7F7F7;-moz-border-radius: 0.555rem;-webkit-border-radius: 0.555rem;border-radius: 0.555rem;font-size:0.725rem;position: absolute;top:10rem;left:2.24rem;z-index:2000;}
        .pay_over .pay_pass{padding-bottom: 1rem;min-height:2.56rem;line-height:2.56rem;border-bottom:1px solid #ccc;box-sizing:border-box;}
        .pay_over .pay_ok{height:1.92rem;line-height:1.92rem;color:#3A79FF;}

        .pay_over .pay_pass p{font-size:0.725rem;margin-bottom:0.2rem;width:100%;height:1rem;}
        .pay_over .pay_pass p span{margin-right:0.5rem;}
    </style>
</head>
<script src="{{ env('CDN_DOMAIN_NAME') }}/js/commonjs/iscroll.js"></script>
<script src="{{ env('CDN_DOMAIN_NAME') }}/js/app.js"></script>
<body onload="loaded()">
<div id="result_box">
    <div class="wrap">
        <div class="result">
            @if(!isset($infos) || count($infos) == 0)
            <div class="result_empty" >
                <div class="empty">
                    <div class="result_img">
                        <img src="/img/00013.png" alt="" />
                    </div>
                </div>
                <p class="result_wrods">搜索订单不存在！</p>
            </div>
            @else

            @foreach($infos as $k => $v)
                    <div class="result_product">
                        <div class="result_title">
                            <div class="result_icon">
                                <img src="/img/00004.png" alt="" />
                                <span>{{ $brandName[$v->brand_id] }}</span>
                                <div class="result_success">
                                    @if(  in_array($v->status,[0,1]))
                                        待支付
                                    @elseif($v->status == 3)
                                        待收货
                                    @elseif($v->status == 2)
                                        交易关闭
                                    @elseif($v->status == -1)
                                        支付失败
                                    @elseif($v->status == -2)
                                        订单失效
                                    @elseif($v->status == -9)
                                        订单超时
                                    @elseif($v->status == 5)
                                        已完成
                                    @elseif($v->status == 6)
                                        线下支付成功
                                    @elseif($v->status == 7)
                                        待收货
                                    @endif
                                </div>
                            </div>
                            <div class="result_code"><span>订单编号：</span>{{ $v->ordernum }}</div>
                        </div>
                        <div class="result_list" onclick="window.location.href='/produc?good_id={{ $v->pro_id }}'">
                            <div class="result_list_l">
                                <img src="{{ env('CDN_DOMAIN_NAME') }}/upload/{{ $v->face }}" alt="" class="result_list_img" />
                            </div>
                            <div class="result_list_r">
                                <div class="result_list_name">
                                    <p class="result_list_tit">{{ $pros[$v->pro_id] }}</p>
                                    <p class="result_price">￥<b>{{ sprintf("%.2f",$v->total_price/$v->num) }}</b></p>
                                </div>
                                <p class="result_list_words">款号：{{ $v->girard }}</p>
                                <div class="result_list_color">
                                    <p class="result_list_hue">颜色：{{ $v->color }}</p>
                                    <p class="result_list_post">邮费：￥{{ sprintf("%.2f",$v->postage_estimate) }}</p>
                                </div>
                                <div class="result_list_b">
                                    @if($v->pre_sale == 1)
                                        <p class="result_list_postage">数量：{{ $v->num }}件</p>
                                        <a href="javascript:;" class="deTa" style="float:left;width:2rem;text-align:end;" abc="{{$v->id}}">详情</a>
                                    @else
                                        <p class="result_list_postage">数量：{{ $v->num }}手</p>
                                    @endif
                                    <p class="result_sum">合计：<i>￥{{sprintf("%.2f", $v->total_price +$v->postage_estimate) }}</i></p>
                                </div>
                            </div>
                        </div>
                        <div class="result_btn">
                            <span class="agency">代理：{{ $companys[$v->company_id] }}</span>
                        </div>
                    </div>
                @endforeach

            @endif
        </div>
    </div>
    <div class="pay_mask2 pay_mask" style="display:none;"></div>
    <div class="pay_over" style="display:none;">
        <div class="pay_pass"></div>
        <div class="pay_ok">确定</div>
    </div>
</div>
</body>
<script>
    /*滚动*/
    var myScroll;
    function loaded () {
        setTimeout(function(){
            myScroll = new IScroll('.wrap', {
                mouseWheel: true,
                click: true
            });
        },100);
    }
    document.addEventListener('touchmove', function (e) {e.preventDefault();},false);

    $(".deTa").bind('click', function(event) {

//        $(document).on("click",".deTa",function(event){
        event.stopPropagation();
        var id=$(this).attr("abc");
        $.ajax({
            headers: {'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')},
            url: '/fetch-sale-order-info/'+id,
            data: {},
            type: 'get',
            dataType: 'json',
            success: function (data) {
                if (data.result.success) {
                    $(".pay_pass").empty();
                    var res=data.content;
                    var str='';
                    for(var k in res){
                        str=str+'<p><span>'+res[k].girard+'</span><span>'+res[k].color+'</span><span>'+res[k].size+'码</span><span>'+res[k].num+'件</span></p>';
                    }
                    $(".pay_pass").append(str);
                    $(".pay_over").show();
                    $(".pay_mask2").show();
                } else {
                    $(".faceImg").attr("src", "/img/weep.png");
                    $(".oHandle").text(data.result.errorMsg);
                    $(".oSuccess").show(0).delay(1000).hide(0);
                }
            }
        })

    });
    $(".pay_ok").click(function(){
        $(".pay_over").hide();
        $(".pay_mask2").hide();
    })
</script>
</html>
